<template>
  <div class="user">
    <!-- 面包屑 -->
    <el-breadcrumb separator="/" class="breadcrumb">
      <el-breadcrumb-item :to="{ path: '/index' }">
        <el-icon><House /></el-icon>首页
      </el-breadcrumb-item>
      <el-breadcrumb-item>系统设置</el-breadcrumb-item>
      <el-breadcrumb-item>个人中心</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 标签页 -->
    <el-tabs v-model="activeName" class="demo-tabs">
      <el-tab-pane label="我的信息" name="first">
        <div class="xinxi">
          <div>
            头像：<img
              src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fci.xiaohongshu.com%2Fede25050-9ed9-37cb-f842-094fdc4a74c1%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fci.xiaohongshu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1689491426&t=58814cf4c42ff0f798432c18a225e720"
              alt=""
            />
          </div>
          <div>账号：admin</div>
          <div>姓名：黄浪浪</div>
          <div>部门：项目部</div>
          <div>岗位：项目经理</div>
          <div>电子邮箱：12580@163.com</div>
          <div>手机号：1212312345</div>
          <el-button type="primary" @click="change()">保存</el-button>
        </div>
      </el-tab-pane>

      <el-tab-pane label="修改密码" name="second">
        <el-form
          ref="ruleFormRef"
          :model="ruleForm"
          :rules="rules"
          label-width="120px"
          class="demo-ruleForm"
          status-icon
        >
          <el-form-item label="原密码" prop="password">
            <el-input
              v-model="ruleForm.password"
              type="password"
              show-password
              placeholder="请输入原密码"
            />
          </el-form-item>
          <el-form-item label="新密码" prop="newpassword">
            <el-input
              v-model="ruleForm.newpassword"
              type="password"
              show-password
              placeholder="请输入新密码"
            />
          </el-form-item>
          <el-form-item label="确认新密码" prop="newpasswordb">
            <el-input
              v-model="ruleForm.newpasswordb"
              type="password"
              show-password
              placeholder="确认新密码"
            />
          </el-form-item>
        </el-form>
        <el-button type="primary" @click="change()">保存</el-button>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script setup>
import { ref } from "vue";
var activeName = ref("first");
var ruleFormRef = ref();
var ruleForm = ref({
  password: "",
  newpassword: "",
  newpasswordb: "",
});
var rules = ref({
  password: [{ required: true, message: "请输入密码", trigger: "blur" }],
  newpassword: [{ required: true, message: "请输入密码", trigger: "blur" }],
  newpasswordb: [{ required: true, message: "请输入密码", trigger: "blur" }],
});
var change = () => {
  ruleFormRef.value.validate((valid, fields) => {
    if (valid) {
      ElNotification({
        title: "通知",
        message: "修改密码成功",
        type: "success",
        duration: 2000,
      });
      ruleForm.value = {};
    } else {
      ElNotification({
        title: "通知",
        message: "请检查输入信息",
        type: "error",
        duration: 2000,
      });
    }
  });
};
</script>

<style scoped lang="scss">
.user {
  .breadcrumb {
    font-size: 20px;
  }
  .demo-tabs {
    height: 500px;
    margin: 20px 0;
    // position: relative;

    .xinxi {
      margin: 10px 20px;
      div {
        margin: 20px;
        img {
          width: 100px;
        }
      }
    }
  }
  .el-input {
    max-width: 300px;
  }
}
</style>